import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
/**
 * 
 * @author chandra
 *
 */
public class savarNa {
		
	public String split(String word, Map<String, String> dict){
		for(int i = 0; i < word.length()-1; i++){
			if(word.substring(i, i+2).equals("aa") || word.substring(i, i+2).equals("ii") ||
					word.substring(i, i + 2).equals("uu")) {
				String w1 = word.substring(0, i + 1);
				String w2 = word.substring(i);
				String w3 = word.substring(i + 1);
				String w4 = word.substring(i - 1, i) + w3;
				if ((dict.containsKey(w1) == true && dict.containsKey(w2) == true)) {
					String a = w1 + " " + w2;
					return a;
				} else if ((dict.containsKey(w1) == true && dict
						.containsKey(w3) == true)) {
					String a = w1 + " " + w3;
					return a;
				} else if ((dict.containsKey(w1) == true && dict
						.containsKey(w4) == true)) {
					String a = w1 + " " + w4;
					return a;
				}
			}// end if
			if (word.codePointAt(i) == 0x93E || word.codePointAt(i) == 0x942
					|| word.codePointAt(i) == 0x940) {
				String w1 = word.substring(0, i); // raama
				String w2 = word.substring(i + 1);
				String w3 = null;
				String w4 = null;
				String w5 = null;
				if (word.codePointAt(i) == 0x93E) {
					w3 = "आ" + w2;
					w4 = w2 + "ः";
					w2 = "अ" + w2;
					w5 = w1 + "ा";
				} else if (word.codePointAt(i) == 0x940) {
					w1 = w1 + "ि";
					w3 = "ई" + w2;
					w4 = w2 + "ः";
					w2 = "इ" + w2;
				} else if (word.codePointAt(i) == 0x942) {
					w1 = w1 + "ु";
					w3 = "ऊ" + w2;
					w4 = w2 + "ः";
					w2 = "उ" + w2;
				}
				String w6 = null;
				if (dict.containsKey(w1) == true)
					w6 = w1;
				else if (dict.containsKey(w5))
					w6 = w5;
				if (w6 != null) {			
					if (dict.containsKey(w2) == true) {
						String a = w6 + " " + w2;
						return a;
					} else if (dict.containsKey(w3) == true) {
						String a = w6 + " " + w3;
						return a;
					} else if (dict.containsKey(w4) == true) {
						String a = w6 + " " + w3;
						return a;
					}
				}
			}// end if
		}// end for
		return "Word doesn't contain sandhi.";
	}// end method
}//end class

